<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center platformMessage_flex_0"
			:style="{height:(64+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub platformMessage_fd0_0'>
				<view class='flex flex-wrap align-center platformMessage_fd0_0_c0'
					@tap.stop="handleJumpDiy" data-type="back" data-url="1">
					<text class='fu-iconfont2  platformMessage_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-stretch justify-center'>
					<text class='platformMessage_fd0_0_c1_c0'>单词-海马体2抗遗忘训练词汇记录</text>
				</view>
				<view class='flex flex-wrap align-center platformMessage_fd0_0_c0'></view>
			</view>

		</view>
		<view :style="{height: (64+StatusBarRpx)+'rpx'}"></view>
		
		<view class="loading_css" v-if="isShow">
			<uv-loading-icon size="24" mode="circle" color="#4087FD" :show="true"></uv-loading-icon>
			<view>加载中</view>
		</view>

		<view class="flex flex-direction align-stretch benben-flex-layout platformMessage_flex_1" v-else>
			<view class="intensify" v-for="(item, index) in list" :key="index">
				<view class="intensify_title" @tap.stop="selectArticle(index)">
					<view class="title_content">{{item.speechlist_title}}</view>
					<template v-if="item.isSelect">
						<view class="title_icon">
							<text>收起</text>
							<image :src='STATIC_URL+"103.png"' mode=""></image>
						</view>
					</template>
					<template v-else>
						<view class="title_icon">
							<text>展开</text>
							<image :src='STATIC_URL+"104.png"' mode=""></image>
						</view>
					</template>
				</view>
				<view class="forget_list" v-if="item.isSelect">
					<view class="forget_item" :class="k == (item.list.length -1) ? 'no_line' : ''" v-for="(v, k) in item.list" @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/index/antiForget/wordReinforcement?aid=${v.aid}&data_type=2`">
						<view class="item_content">
							<view class="content_1">{{v.name}}</view>
							<view class="content_2" @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/index/print/wordTwo?id=${v.aid}&prinType=2`">打印</view>
							<view class="content_3" @tap.stop="print(v.aid)">后台打印</view>
							<view class="content_4">
								<text class="qianghua" v-if="v.is_strengthen == 2">待强化</text>
								<text class="qianghua_end" v-if="v.is_strengthen == 1">已完成</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<view class="loadmore" v-if="last_page > 1">
				<uv-load-more :status="status" :loading-text="loadingText" :loadmore-text="loadmoreText"
					:nomore-text="nomoreText" />
			</view>
			
		</view>
		<view class="noData" v-if="list.length == 0 && !isShow">
			<image :src='STATIC_URL+"no.png"'></image>
		</view>
		<uv-modal width="300rpx" :showCancelButton="true" :closeOnClickOverlay="false" confirmColor="#4087FD" ref="modal" title="提示" :content='content' align="center" @confirm="confirm" :textStyle="{fontSize: 20 + 'px'}"></uv-modal>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"content": "确定提交后台打印？",
				
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"loadingText": '努力加载中',
				"loadmoreText": '轻轻上拉',
				"nomoreText": '没有更多了',
				"isShow": true,
				"print_id": "",  // 后台打印的id
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
		
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getList();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			// 海马体2单词记录   post65706d88844d0
			getList() {
				this.$api.post(global.apiUrls.post65706d88844d0, {
					page: this.page
				}).then(res => {
					// console.log(res);
					uni.stopPullDownRefresh();
					this.isShow = false;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (res.data.data.data.length > 0) {
							res.data.data.data.forEach((v, k) => {
								v.isSelect = true;
							})
						}
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			selectArticle(index) {
				this.list[index].isSelect = !this.list[index].isSelect;
				this.$forceUpdate();
			},
			print(aid) {
				this.print_id = aid;
				this.$refs.modal.open();
			},
			confirm() {
				this.$refs.modal.close();
				this.$api.post(global.apiUrls.post657fe91ccab6f, {
					record_id: this.print_id
				}).then(res => {
					this.$message.info(res.data.msg);
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.intensify {
		margin: 15rpx 0 0;
		background: #fff;
		border-radius: 10rpx;
		.intensify_title {
			padding: 20rpx;
			border-bottom: 1px solid #eeeeee;
			display: flex;
			align-items: center;
			font-size: 20rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			color: #333333;
			.title_content {
				width: 91%;
				font-size: 20rpx;
				font-weight: 500;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				overflow: hidden;
				-webkit-line-clamp: 1;
			}
			.title_icon {
				width: 9%;
				display: flex;
				align-items: center;
				font-size: 18rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				color: #333333;
				image {
					width: 15rpx;
					height: 9rpx;
					margin-left: 8rpx;
				}
			}
		}
		.forget_list {
			padding: 0 20rpx;
			.forget_item {
				padding: 17rpx 0;
				border-bottom: 1px solid #eeeeee;
				
				.item_content {
					font-size: 18rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #666666;
					line-height: 26rpx;
					display: flex;
					align-items: center;
					width: 100%;
					.content_1 {
						font-size: 18rpx;
						color: #666666;
					}
					.content_2 {
						width: 70rpx;
						height: 30rpx;
						line-height: 28rpx;
						text-align: center;
						background: #4087FD;
						border-radius: 15rpx;
						font-size: 15rpx;
						color: #fff;
						margin-left: 20rpx;
					}
					.content_3 {
						width: 100rpx;
						height: 30rpx;
						line-height: 28rpx;
						text-align: center;
						background: #F0F6FF;
						border-radius: 15rpx;
						font-size: 15rpx;
						color: #4087FD;
						margin-left: 20rpx;
					}
					.content_4 {
						font-size: 18rpx;
						margin: 0 0 0 auto;
						.qianghua {
							color: #FA3B3D;
						}
						.qianghua_end {
							color: #4DC777;
						}
					}
				}
			}
			.no_line {
				border-bottom: 1px solid transparent;
			}
		}
	}
	
	.content_img {
		width: 100%;
		height: 219rpx;
		margin-top: 20rpx;
		image {
			width: 100%;
			height: 100%;
			border-radius: 10rpx;
		}
	}
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(248, 248, 248, 1);
		background-size: 100% auto !important;
	}

	.platformMessage_flex_0 {
		background: #fff;
		width: 100%;
		height: 64rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.platformMessage_fd0_0_c1_c0 {
		font-size: 25rpx;
		font-weight: 500;
		color: #333333;
		line-height: 64rpx;
	}

	.platformMessage_fd0_0_c0_c0 {
		font-size: 25rpx;
		color: #333;
	}

	.platformMessage_fd0_0_c0 {
		width: 50rpx;
		height: 50rpx;
	}

	.platformMessage_fd0_0 {
		padding: 0rpx 25rpx 0rpx 25rpx;
	}

	.platformMessage_flex_1 {
		// margin: 16rpx 25rpx 16rpx 25rpx;
		// background: #fff;
		// border-radius: 10rpx;
		padding: 0 25rpx;
	}

	.platformMessage_fd1_0_c2 {
		font-size: 18rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		color: #999999;
		line-height: 25rpx;
	}

	.platformMessage_fd1_0_c1 {
		margin: 10rpx 0rpx 0rpx 0rpx;
		font-size: 18rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		color: #999999;
		line-height: 26rpx;
		// -webkit-line-clamp: 2;
		// overflow: hidden;
		// text-overflow: ellipsis;
		// display: -webkit-box;
		// -webkit-box-orient: vertical;
	}

	.platformMessage_fd1_0_c0 {
		font-size: 20rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		color: #333333;
		// line-height: 45rpx;
		// -webkit-line-clamp: 1;
		// overflow: hidden;
		// text-overflow: ellipsis;
		// display: -webkit-box;
		// -webkit-box-orient: vertical;
	}

	.platformMessage_fd1_0 {
		// background: #fff;
		width: 100%;
		padding: 20rpx 25rpx 20rpx 25rpx;
		border-bottom: 1px solid #eee;
	}
</style>